import 'package:get/get.dart';
import 'package:flutter/material.dart';
import '../page/splash/splash_page.dart';
import '../page/splash/splash_controller.dart';
import '../page/main/primary_screen.dart';
import '../page/main/primary_screen_binding.dart';
import '../page/auth/user_access_page.dart';
import '../page/auth/user_access_binding.dart';
import '../page/plant_encyclopedia/plant_encyclopedia_page.dart';
import '../page/plant_encyclopedia/plant_encyclopedia_controller.dart';
import '../page/plant_encyclopedia/plant_detail_page.dart';
import '../page/plant_encyclopedia/plant_detail_controller.dart';
import '../page/growth_tracking/growth_tracking_page.dart';
import '../page/growth_tracking/growth_tracking_controller.dart';
import '../page/communal/plant_challenge_page.dart';
import '../page/communal/plant_challenge_page_controller.dart';
import '../page/communal/post_detail_page.dart';
import '../page/communal/post_detail_controller.dart';
import '../page/ai_chat/ai_chat_page.dart';
import '../page/ai_chat/ai_chat_controller.dart';
import '../page/communal/chat_group_list_page.dart';
import '../page/communal/chat_group_list_controller.dart';
import '../page/communal/group_chat_page.dart';
import '../page/communal/group_chat_controller.dart';
import '../page/chat/single_chat_page.dart';
import '../page/chat/single_chat_controller.dart';
import '../page/communal/post_publish_page.dart';
import '../page/communal/post_publish_controller.dart';
import '../page/video/video_player_page.dart';
import '../page/video/video_player_controller.dart';
import '../page/my/profile_page.dart';
import '../page/my/profile_page_controller.dart';
import '../page/my/other_profile_page.dart';
import '../page/my/other_profile_page_controller.dart';
import '../page/my/settings_page.dart';
import '../page/my/settings_page_controller.dart';
import '../page/my/follow_list_page.dart';
import '../page/my/follow_list_page_controller.dart';

/// 应用路由配置
class AppRoutes {
  static const String splash = '/splash';
  static const String primary = '/primary';
  static const String userAccess = '/user-access';
  static const String plantEncyclopedia = '/plant-encyclopedia';
  static const String plantDetail = '/plant-detail';
  static const String growthTracking = '/growth-tracking';
  static const String plantChallenge = '/plant_challenge';
  static const String postDetail = '/post-detail';
  static const String aiChat = '/ai-chat';
  static const String chatGroupList = '/chat-group-list';
  static const String groupChat = '/group-chat';
  static const String singleChat = '/single-chat';
  static const String postPublish = '/post-publish';
  static const String videoPlayer = '/video-player';
  static const String profile = '/profile';
  static const String otherProfile = '/other-profile';
  static const String settings = '/settings';
  static const String followList = '/follow-list';

  static final List<GetPage> routes = [
    GetPage(
      name: splash,
      page: () => const SplashPage(),
      binding: BindingsBuilder(() {
        Get.put(SplashController());
      }),
    ),
    GetPage(
      name: userAccess,
      page: () => const UserAccessPage(),
      binding: UserAccessBinding(),
    ),
    GetPage(
      name: primary,
      page: () => const PrimaryScreen(),
      binding: PrimaryScreenBinding(),
    ),
    GetPage(
      name: plantEncyclopedia,
      page: () => const PlantEncyclopediaPage(),
      binding: BindingsBuilder(() {
        Get.put(PlantEncyclopediaController());
      }),
      transition: Transition.rightToLeftWithFade,
      transitionDuration: const Duration(milliseconds: 500),
      curve: Curves.easeOut,
    ),
    GetPage(
      name: plantDetail,
      page: () => const PlantDetailPage(),
      binding: BindingsBuilder(() {
        Get.put(PlantDetailController());
      }),
      transition: Transition.rightToLeftWithFade,
      transitionDuration: const Duration(milliseconds: 500),
      curve: Curves.easeOut,
    ),
    GetPage(
      name: growthTracking,
      page: () => const GrowthTrackingPage(),
      binding: BindingsBuilder(() {
        Get.put(GrowthTrackingController());
      }),
      transition: Transition.leftToRightWithFade,
      transitionDuration: const Duration(milliseconds: 500),
      curve: Curves.easeOut,
    ),
    GetPage(
      name: plantChallenge,
      page: () => const PlantChallengePage(),
      binding: BindingsBuilder(() {
        Get.put(PlantChallengePageController());
      }),
    ),
    GetPage(
      name: postDetail,
      page: () => const PostDetailPage(),
      binding: BindingsBuilder(() {
        Get.put(PostDetailController());
      }),
      transition: Transition.zoom,
      transitionDuration: const Duration(milliseconds: 500),
      curve: Curves.easeOut,
    ),
    GetPage(
      name: aiChat,
      page: () => const AiChatPage(),
      binding: BindingsBuilder(() {
        Get.put(AiChatController());
      }),
      transition: Transition.circularReveal,
      transitionDuration: const Duration(milliseconds: 500),
      curve: Curves.easeOut,
    ),
    GetPage(
      name: chatGroupList,
      page: () => const ChatGroupListPage(),
      binding: BindingsBuilder(() {
        Get.put(ChatGroupListController());
      }),
      transition: Transition.circularReveal,
      transitionDuration: const Duration(milliseconds: 500),
      curve: Curves.easeInOut,
    ),
    GetPage(
      name: groupChat,
      page: () => const GroupChatPage(),
      binding: BindingsBuilder(() {
        Get.put(GroupChatController());
      }),
      transition: Transition.rightToLeft,
      transitionDuration: const Duration(milliseconds: 500),
      curve: Curves.easeInOut,
    ),
    GetPage(
      name: singleChat,
      page: () => const SingleChatPage(),
      binding: BindingsBuilder(() {
        Get.put(SingleChatController());
      }),
      transition: Transition.fadeIn,
      transitionDuration: const Duration(milliseconds: 500),
      curve: Curves.easeInOut,
    ),
    GetPage(
      name: postPublish,
      page: () => const PostPublishPage(),
      binding: BindingsBuilder(() {
        Get.put(PostPublishController());
      }),
      transition: Transition.downToUp,
      transitionDuration: const Duration(milliseconds: 500),
      curve: Curves.easeOut,
    ),
    GetPage(
      name: videoPlayer,
      page: () => const VideoPlayerPage(),
      binding: BindingsBuilder(() {
        Get.put(VideoPlayerController());
      }),
      transition: Transition.zoom,
      transitionDuration: const Duration(milliseconds: 500),
      curve: Curves.easeOut,
    ),
    GetPage(
      name: profile,
      page: () => const ProfilePage(),
      binding: BindingsBuilder(() {
        Get.put(ProfilePageController());
      }),
      transition: Transition.fadeIn,
      transitionDuration: const Duration(milliseconds: 500),
      curve: Curves.easeOut,
    ),
    GetPage(
      name: otherProfile,
      page: () => const OtherProfilePage(),
      binding: BindingsBuilder(() {
        Get.put(OtherProfilePageController());
      }),
      transition: Transition.zoom,
      transitionDuration: const Duration(milliseconds: 500),
      curve: Curves.easeOut,
    ),
    GetPage(
      name: settings,
      page: () => const SettingsPage(),
      binding: BindingsBuilder(() {
        Get.put(SettingsPageController());
      }),
      transition: Transition.rightToLeft,
      transitionDuration: const Duration(milliseconds: 500),
      curve: Curves.easeOut,
    ),
    GetPage(
      name: followList,
      page: () => const FollowListPage(),
      binding: BindingsBuilder(() {
        Get.put(FollowListPageController());
      }),
      transition: Transition.circularReveal,
      transitionDuration: const Duration(milliseconds: 500),
      curve: Curves.easeOut,
    ),
  ];
}
